<script type="text/javascript" src="/scripts/utilities.js"></script>
		<form enctype="multipart/form-data" id="messageform" name="messageform" method="POST" action="/album/index/update-album-title/<?php echo base64_encode($ctx->Album['album_id']);?>/<?php echo base64_encode($ctx->type);?>" >
		<div class="PhoVidCrtForm">
		<div class="pad_t8">
		<label>Album Name</label><input type="text" id="albumName" name="albumName" value="<?php echo $ctx->Album['title'];?>" />
		<div class="clear"></div>
		</div>
		<div class="pad_t8">
		<label>&nbsp;</label>
		<select style="width:350px;" id="event" name="event">
				<option value="0" >Link to Existing Event</option>
				<?php 
				$i=0;
				while($i<($ctx->eventCount))
				{ ?>
				<?php if($ctx->events[$i]['event_id'] == $ctx->Album['event_id']) {?>
				<option value="<?php echo $ctx->events[$i]['event_id']; ?>" selected="selected"><?php echo $ctx->Album['event_name']; ?></option>
				<?php } else { ?>
				<option value="<?php echo $ctx->events[$i]['event_id']; ?>"><?php echo $ctx->events[$i]['text']; ?></option>  
				<?php } ?>
				<?php $i++; }?>
		</select>
		<div class="pad_t8" id="event1">
		
		</div>
		<div class="Fleft pad_18" id="or1">or</div><div class="Fleft pad_18" id="showevent"><a class="Button" onclick="showEventDiv()"><span>Add Event</span></a></div>
		
		<div class="clear"></div>
		</div>
		<div class="pad_t8">
		<label>Description</label><textarea id="description" name="description" style="height:30px"><?php echo $ctx->Album['description'];?></textarea>
		<div class="clear"></div>
		</div>
		
		<div id="showdiv">
		</div>
		<div class="clear"></div>
		<div class="pad_t8">
		<label>&nbsp;</label>
		<?php if($ctx->Album['visitors_allow']=="N"){ ?>
		<p class="Fleft pad_t5"><input type="checkbox" id="chkvisitor" name="chkvisitor" border="0" align="left" style="width:15px;border:0;" />&nbsp;<span class="txt_sm" id="visitors_label">Visitors can upload Photos&nbsp;&nbsp;&nbsp;</span> </p>
        <? } else { ?>
		<p class="Fleft pad_t5"><input type="checkbox" id="chkvisitor" checked="checked" name="chkvisitor" border="0" align="left" style="width:15px;border:0;" />&nbsp;<span class="txt_sm">Visitors can upload Photos</span>&nbsp;&nbsp;&nbsp; </p>
        <? } ?>
		<?php if($ctx->Album['comments_allow']=="N")  { ?>
		<p class="Fleft pad_115 pad_t5"><input type="checkbox" id="chkcomments" name="chkcomments" border="0" align="left" style="width:15px;border:0;" />&nbsp;<span class="txt_sm">Comments</span> </p>
		 <? } else { ?>
		 <p class="Fleft pad_115 pad_t5"><input type="checkbox" id="chkcomments" checked="checked" name="chkcomments" border="0" align="left" style="width:15px;border:0;" />&nbsp;<span class="txt_sm">Comments</span> </p>
		<? } ?>
		<div class="clear"></div>
		</div>
        <div class="pad_t15 pad_1108">
		<a class="Button" href="javascript:void(0);" onclick="update(document.messageform);"><span>Update</span></a>
		</div>
		<div class="clear"></div>
		</div>
	</form>
<script>
//<![CDATA[

function update(frm)
{
	var result = false;
	//alert(frm.message);return false;
	result = !isEmpty(frm.albumName, "Please Enter album name") ;
	if(result) result = !isEmpty(frm.description, "Please Enter description") ;
	if(result)
	{
		$('#messageform').submit();
	}
	//alert(result);
	//return result;
}
function showGroups(obj)
{
	//alert(obj.value);return false;
	if(obj.value == "group")
	{
	//alert(obj.value);return false;
	document.getElementById('showdiv').innerHTML = '<div><label>Select Group</div></label><select id="group" name="group[]" class="medium" size=4 multiple><option value="0" >--- Options ---</option><?php $i=0;while($i<($ctx->count)){ ?><option value="<?php echo $ctx->groups[$i]['group_id']; ?>"><?php echo $ctx->groups[$i]['name']; ?></option><?php $i++; }?></select>';
	}
	else 
	{
	document.getElementById('showdiv').innerHTML='';
	}

}
function showEventDiv()
{
	$('#event').hide();
	$('#event2').hide();
	$('#event1').show();
	$('#showevent').hide();
	$('#or1').hide();
	document.getElementById('event1').innerHTML = '<input type="text" name="eventname" id="eventname" style="width: 350px;" value=""/>';

}

//]]>
</script>
